package org.qs.webservice.service.impl;

import java.util.ArrayList;
import java.util.Collection;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.ListIterator;
import java.util.Map;

import javax.annotation.Resource;

import org.qs.webservice.dao.user.UserGradeMapper;
import org.qs.webservice.domain.UserGrade;
import org.qs.webservice.service.QSConfigService;
import org.qs.webservice.util.IReadUtils;
import org.qs.webservice.vo.Grade;
import org.springframework.stereotype.Service;


@Service
public class QSConfigServiceImpl implements QSConfigService {
	@Resource
	private UserGradeMapper userGradeMapper;
	@Override
	public String getVipConfig() {
		Map<String, Object> tokenMap = new HashMap<String, Object>(); 
		List<UserGrade> list = userGradeMapper.getUserGradeList();
		List<Grade> grades = new ArrayList<Grade>();
			
		for(UserGrade userGrade :list){
			Grade grade = new Grade();
			grade.setGrade_id(userGrade.getGrade_id());
			grade.setGrade_name(userGrade.getGrade_name());
			grade.setGrade_value(userGrade.getGrade_value()+"");
			grades.add(grade);
		}
		tokenMap.put("code",200);
		tokenMap.put("content",grades);
		
		return IReadUtils.beanToJson(tokenMap);
	}

}
